String.prototype.trimAll=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
String.prototype.fixLength=function(){return this.replace(/[^\x00-\xff]/g,"aa").length;}

if(typeof RD_RESUMELABEL=="undefined"||!RD_RESUMELABEL) var RD_RESUMELABEL={
	itemsCustom : null,//string : labelID,text,className
	itemsDefault : ['1,待定,cvLabelWaiting','2,不符合职位要求,cvLabelnoPass','3,等待通知面试,cvLabelPass'],
	items : [],
	dataSepa : ',',
	nowSetLabelCV : null,
	//flagAJAXgetLabels : false,
	showAJAXResInfTimer : null,
	statusAJAXGetLabels : 'ok',
	statusAJAXSetLabels : 'ok',
	statusAJAXNewLabel : 'ok',
	statusAJAXEditLabel : 'ok',
	cvIdAJAXSetLabels : [],
	nowSetMoreLabel : null,
	customLabelClass : 12,
	maxCustomLabel : 10,
	initImg : ["http://rd2.zhaopin.com/s/images/erd2/iconcvwaiting.gif","http://rd2.zhaopin.com/s/images/erd2/iconcvnopass.gif","http://rd2.zhaopin.com/s/images/erd2/iconcvpass.gif","http://rd2.zhaopin.com/s/images/erd2/icon_box12color.gif"]
};

RD_RESUMELABEL.fnInitImg = function(){
	var img;
	if(RD_RESUMELABEL.initImg) for(var i=0;i<RD_RESUMELABEL.initImg.length;i++){
		img = new Image(1,1);
		img.src = RD_RESUMELABEL.initImg[i];
	}
}();

RD_RESUMELABEL.Dom = {
	getCurrentStyle : function(e,s){//read only
    	var retVal;
    	if(e.currentStyle) retVal=e.currentStyle[s];//IE
		else if(document.defaultView&&document.defaultView.getComputedStyle) retVal=document.defaultView.getComputedStyle(e,null).getPropertyValue(this.dashify(s));//Mozilla
		else retVal=null;//Safari
    	return retVal;
	},
	dashify : function(str){
    	return str.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();
	},
	getLocalOffset : function(offset,direction){//direction: Top Left
		var y=offset['offset'+direction];
    	var div;
    	try{div=offset.offsetParent;}
		catch(ex){return y;}
    	while(div){//&&RD_RESUMELABEL.Dom.getCurrentStyle(div,'position')=='static'
        	y+=div['offset'+direction];
        	try{div=div.offsetParent;}
			catch(ex){return y;}
    	}
    	return y;
	},
	myAttachEvent : function(d,e,f){
		try {
			if(d.attachEvent) d.attachEvent("on"+e,f);
			else if(d.addEventListener) d.addEventListener(e,f,false);
			else{
				var oldF = eval('d.on'+e);
				if(typeof oldF!='function') eval('d.on'+e+'=f');
				else eval('d.on'+e)=function(){oldF();f();}
			}
		}
		catch (error){}
	},
	encode : {
		html : function(c){
			var c = c.replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
			return c;
		},
		js : function(c){
			var c = c.replace(/'/g,'\\\'');
			return c;
		},
		htmlValue : function(c){
			var c = c.replace(/"/g,'&quot;');
			return c;
		},
		url : function(c){
			return window["encodeURIComponent"]?window["encodeURIComponent"](c):escape(c);
		}
	}
};

RD_RESUMELABEL.changeLiClass = function(o,c){
	o.className = c=='over'?'mouseover':'mouseout';
};

RD_RESUMELABEL.fixLabelItems = function(){
	var i,custom=null;
	RD_RESUMELABEL.items = [];
	if(RD_RESUMELABEL.itemsCustom && typeof RD_RESUMELABEL.itemsCustom=='string') custom = RD_RESUMELABEL.itemsCustom.split(RD_RESUMELABEL.dataSepa);
	for(i=0;RD_RESUMELABEL.itemsDefault[i];i++) RD_RESUMELABEL.items.push(RD_RESUMELABEL.itemsDefault[i]);
	if(custom!=null&&custom.length) for(i=0;i<custom.length;i++){
		RD_RESUMELABEL.items.push(custom[i]+RD_RESUMELABEL.dataSepa+custom[i+1]+RD_RESUMELABEL.dataSepa+custom[i+2]);
		i = i + 2;
	}
};

RD_RESUMELABEL.fnGetCustomLabel = function(){
	if(RD_RESUMELABEL.statusAJAXGetLabels=='ajax') return;
	RD_RESUMELABEL.statusAJAXGetLabels='ajax';
	var data = 'OptType=3' + '&t=' + new Date().getTime();
	submitCallback(data,'http://rd2.zhaopin.com/s/resuadmi/ajx_company_label.asp',RD_RESUMELABEL.handleInitCVListResponse,'get');
}
RD_RESUMELABEL.fnInitCVListTab = function(){
	RD_RESUMELABEL.errCon = document.getElementById('cvAJAXInfoCon')||null;
	/*if(RD_RESUMELABEL.errCon==null){
		RD_RESUMELABEL.errCon = document.createElement('div');
		RD_RESUMELABEL.errCon.id = 'cvAJAXInfoCon';
		RD_RESUMELABEL.errCon.className = 'ajaxErr';
		document.body.appendChild(RD_RESUMELABEL.errCon);
	}*/
	RD_RESUMELABEL.fnInit();
	if(RD_RESUMELABEL.itemsCustom==null) RD_RESUMELABEL.fnGetCustomLabel();
	else{
		//RD_RESUMELABEL.fnInit();
	}
}
RD_RESUMELABEL.handleInitCVListResponse = function(success,responseText,objPar){
	RD_RESUMELABEL.statusAJAXGetLabels='ok';
	if(success){
		var indexS = responseText.indexOf(':');
		var flag = indexS>-1?responseText.substring(0,indexS).toLowerCase():'';
		var responseStr = indexS>-1?responseText.substring(indexS+1):'';
		if(flag=='ok'){
			RD_RESUMELABEL.itemsCustom = responseStr;
			RD_RESUMELABEL.fixLabelItems();
			//RD_RESUMELABEL.fnInit();
			return;
		}
	}
	RD_RESUMELABEL.showAJAXErrInfo('AJAX出错，标签功能暂时不能使用，请稍候再试！');	
}

RD_RESUMELABEL.buildPopDiv = function(){
	var myDiv = document.createElement('div');
	myDiv.style.visibility = 'hidden';
	myDiv.style.position = 'absolute';
	myDiv.style.top = '-100px';
	myDiv.style.left = '-100px';
	myDiv.style.zIndex = '1000';
	return myDiv;
}
RD_RESUMELABEL.buildPopDivOne = function(){
	var myDiv = RD_RESUMELABEL.buildPopDiv();
	myDiv.className = 'popupDiv_mini';
	myDiv.id = 'RD_setCVLabel_one_div';
	var mySubDiv = document.createElement('div');
	mySubDiv.className = 'title';
	var myText = document.createTextNode('修改为');
	mySubDiv.appendChild(myText);
	myDiv.appendChild(mySubDiv);
	RD_RESUMELABEL.ajaxDhtml_one = document.createElement('div');
	RD_RESUMELABEL.ajaxDhtml_one.className = 'content';
	RD_RESUMELABEL.ajaxDhtml_one.style.paddingLeft = '0';
	RD_RESUMELABEL.ajaxDhtml_one.style.paddingRight = '0';
	myDiv.appendChild(RD_RESUMELABEL.ajaxDhtml_one);
	document.body.appendChild(myDiv);
	myDiv.onclick = function(e){cancelBubble(e)};
	return myDiv;
}
RD_RESUMELABEL.buildPopDivMore = function(){
	var myDiv = RD_RESUMELABEL.buildPopDiv();
	myDiv.style.width = '280px';
	myDiv.className = 'popupDivCon';
	myDiv.id = 'RD_setCVLabel_more_div';
																	
	var mySubDiv = document.createElement('div');
	mySubDiv.className = 'popupDivCon_Title clearfix';
																	
	RD_RESUMELABEL.dhtml_moreTitle = document.createElement('div');
	RD_RESUMELABEL.dhtml_moreTitle.className = 'titleCon';
	RD_RESUMELABEL.dhtml_moreTitle.style.display = 'none';
	mySubDiv.appendChild(RD_RESUMELABEL.dhtml_moreTitle);
																	
	RD_RESUMELABEL.dhtml_moreClose = document.createElement('div');
	RD_RESUMELABEL.dhtml_moreClose.className = 'closeDiv';
	RD_RESUMELABEL.dhtml_moreClose.style.display = 'none';
	RD_RESUMELABEL.dhtml_moreClose.title = '关闭';
	RD_RESUMELABEL.dhtml_moreClose.onclick = function(){RD_RESUMELABEL.hideSetLabelMoreDiv();};
	mySubDiv.appendChild(RD_RESUMELABEL.dhtml_moreClose);
																	
	myDiv.appendChild(mySubDiv);
																	
	RD_RESUMELABEL.dhtml_moreContent = document.createElement('div');
	RD_RESUMELABEL.dhtml_moreContent.className = '';
	RD_RESUMELABEL.dhtml_moreContent.style.display = 'none';
	myDiv.appendChild(RD_RESUMELABEL.dhtml_moreContent);
																	
	document.body.appendChild(myDiv);
	myDiv.onclick = function(e){cancelBubble(e);RD_RESUMELABEL.hideAllCustomLabel();};
	return myDiv;
}
RD_RESUMELABEL.buildPopDivAction = function(o){
	var myDiv = RD_RESUMELABEL.buildPopDiv();
	myDiv.style.width = '70px';
	myDiv.className = 'popupDiv_mini';
	myDiv.id = 'RD_setCVLabel_action_div';
	var mySubDiv = document.createElement('div');
	mySubDiv.className = 'content clearfix';
	myDiv.appendChild(mySubDiv);
	var a = document.createElement('a');
	var insId = myDiv.id+'_add';
	a.id = insId;
	a.href = 'javascript:void(0)';
	a.style.display = 'block';
	a.setAttribute('cvbox',o.cvStr);
	a.appendChild(document.createTextNode('添加标签'));
	RD_RESUMELABEL.allHTML.push(a);
	RD_RESUMELABEL.allInstance[insId] = new RD_RESUMELABEL["cvLabelMoreFac"](a);
	mySubDiv.appendChild(a);
	a = document.createElement('a');
	a.id = myDiv.id+'_del';
	a.href = 'javascript:void(0)';
	a.style.display = 'block';
	a.appendChild(document.createTextNode('删除标签'));
	a.onclick = function(){RD_RESUMELABEL.fnSubmitDelCVLabel_more(o)};
	mySubDiv.appendChild(a);
	document.body.appendChild(myDiv);
	myDiv.onclick = function(e){cancelBubble(e)};
	return myDiv;
}

RD_RESUMELABEL.fnInit = function(){
	/*RD_RESUMELABEL.errCon = document.getElementById('cvAJAXInfoCon')||null;
	if(RD_RESUMELABEL.errCon==null){
		RD_RESUMELABEL.errCon = document.createElement('div');
		RD_RESUMELABEL.errCon.id = 'cvAJAXInfoCon';
		RD_RESUMELABEL.errCon.className = 'ajaxErr';
		document.body.appendChild(RD_RESUMELABEL.errCon);
	}*/
	if(!RD_RESUMELABEL.allHTML || !RD_RESUMELABEL.allHTML instanceof Array) RD_RESUMELABEL.allHTML = [];
	if(!RD_RESUMELABEL.allInstance || !RD_RESUMELABEL.allInstance instanceof Array) RD_RESUMELABEL.allInstance = [];
	var e=/<[^>]+\srdmodule=[\'\"]?([\w|]+)[^>]+/g;
	var g=/id=[\'\"]?([\w\-]+)/i;
	var i,j;
	window.document.body.innerHTML.replace(e,function(a,b){if((i=a.match(g))&&(j=document.getElementById(i[1]))){
														   if(RD_RESUMELABEL[b]){
																if(b=="cvLabelOneFac"&&!RD_RESUMELABEL.dhtml_one) RD_RESUMELABEL.dhtml_one = RD_RESUMELABEL.buildPopDivOne();
																else if(b=="cvLabelMoreFac"&&!RD_RESUMELABEL.dhtml_more) RD_RESUMELABEL.dhtml_more =  RD_RESUMELABEL.buildPopDivMore();
																RD_RESUMELABEL.allHTML.push(j);
																RD_RESUMELABEL.allInstance[j.id] = new RD_RESUMELABEL[b](j);
															}
															return ''}});
};

/*RD_RESUMELABEL.hideLabelDiv = function(){
	if(RD_RESUMELABEL.dhtml_one&&RD_RESUMELABEL.Dom.getCurrentStyle(RD_RESUMELABEL.dhtml_one,'visibility')!='hidden'){
		RD_RESUMELABEL.dhtml_one.style.visibility = 'hidden';
		if(RD_RESUMELABEL.shim) RD_RESUMELABEL.shim.style.visibility = 'hidden';
	}
};*/
RD_RESUMELABEL.cvActionPortFac = function(h){
	var s = this;
	s.html = h;
	s.cvStr = s.html.getAttribute('cvbox')||'';
	s.cv = (s.cvStr!=''&&eval(s.cvStr))?eval(s.cvStr):null;
	if(!RD_RESUMELABEL.dhtml_action) RD_RESUMELABEL.dhtml_action = RD_RESUMELABEL.buildPopDivAction(s);
	RD_RESUMELABEL.Dom.myAttachEvent(s.html,'click',function(e){s.fnClick(e);});
}
RD_RESUMELABEL.cvActionPortFac.prototype = {
	fnClick : function(e){
		var s = this;
		cancelBubble(e);
		
		var flag = false;
		if(s.cv){
			var cvArr = s.cv.length?s.cv:[s.cv];
			for(var i=0;i<cvArr.length;i++) if(cvArr[i].checked){flag=true;break;}
		}
		if(!flag){alert("请选择要添加或删除标签的简历！");return;}

		
		if(!RD_RESUMELABEL.dhtml_action) RD_RESUMELABEL.dhtml_action = RD_RESUMELABEL.buildPopDivAction();
		if(RD_RESUMELABEL.dhtml_action){
			var coord = getXY(s.html);
			var x = coord.x;
			var y = coord.y - parseFloat(RD_RESUMELABEL.dhtml_action.offsetHeight);
			showPopup(RD_RESUMELABEL.dhtml_action.id,e,x,y);
		}
	}
}

RD_RESUMELABEL.cvLabelOneFac = function(h){
	var s = this;
	s.col = 2;
	s.html = h;
	s.htmlIcon = s.html.childNodes[0].childNodes[0];
	s.id = s.html.id;
	var idFixPre = 'r_label';
	s.resumeid = s.id.substr(idFixPre.length);
	s.labelid = s.html.getAttribute('label')||'';
	s.classN = s.htmlIcon.className;
	s.title = s.html.getAttribute('title');
	s.trigger2ids = s.html.getAttribute('trigger2')||null;
	if(s.trigger2ids!=null){
		s.trigger2 = new Array(s.trigger2ids);
		s.trigger2HTML = [];
		for(var i=0;i<s.trigger2.length;i++) if(document.getElementById(s.trigger2[i])) s.trigger2HTML.push(document.getElementById(s.trigger2[i]));
	}
	var data = [];
	/*if(s.title=="null"&&s.labelid!='')
		for(var i=0;RD_RESUMELABEL.items[i];i++){
			if(RD_RESUMELABEL.items[i].indexOf(s.labelid+RD_RESUMELABEL.dataSepa)==0){
				data = RD_RESUMELABEL.items[i].split(RD_RESUMELABEL.dataSepa);
				break;
			}
		}*/
	if(data.length){
		s.htmlIcon.className = data[2];
		s.classN = data[2];
		s.html.setAttribute('title',data[1]);
		s.title = data[1];
	}
	s.fnMouseOver = function(){this.childNodes[0].childNodes[0].className="cvLabelBlank_over";};
	s.fnMouseOut = function(){this.childNodes[0].childNodes[0].className="cvLabelBlank";};
	s.fnOver = null;
	s.fnOut = null;
	if(s.labelid==''||s.labelid=='0'){
		s.htmlIcon.className = 'cvLabelBlank';
		s.classN = 'cvLabelBlank';
		s.html.setAttribute('title','添加标签');
		s.title = '添加标签';
		s.fnOver = s.fnMouseOver;
		s.fnOut = s.fnMouseOut;
	}
	s.showName = s.html.getAttribute("showname")||0;
	if(s.showName==1){//&&s.labelid!=''&&s.labelid!='0'
		s.htmlName = (s.labelid==''||s.labelid=='0')?document.createTextNode(s.title):document.createTextNode("("+s.title+")");
		s.html.appendChild(s.htmlName);
	}
	s.status = 'ok';
	s.html.onmouseover = s.fnOver;
	s.html.onmouseout = s.fnOut;
	s.fnOnClick = function(e){s.fnClick(e);};
	//RD_RESUMELABEL.Dom.myAttachEvent(s.html,'click',s.fnOnClick);
	s.html.onclick = s.fnOnClick;
	RD_RESUMELABEL.Dom.myAttachEvent(s.html,'mouseover',function(e){cancelBubble(e);});
	RD_RESUMELABEL.Dom.myAttachEvent(s.html,'mouseout',function(e){cancelBubble(e);});
	
	if(s.trigger2HTML&&s.trigger2HTML.length) for(i=0;s.trigger2HTML[i];i++) s.trigger2HTML[i].onclick = s.fnOnClick;
	
	//s.html.onclick = function(e){s.fnClick(e);};
}
RD_RESUMELABEL.cvLabelOneFac.prototype = {
	fnClick : function(e){
		var e = e?e:window.event;
		var s = this;
		
		if(s.status=='ajax') return;
		
		cancelBubble(e);
		
		if(!RD_RESUMELABEL.dhtml_one) RD_RESUMELABEL.dhtml_one = RD_RESUMELABEL.buildPopDivOne();
		
		if(RD_RESUMELABEL.dhtml_one){
			//if(RD_RESUMELABEL.dhtml_one.style.visibility=='visible') RD_RESUMELABEL.dhtml_one.style.visibility = 'hidden';
			RD_RESUMELABEL.ajaxDhtml_one.innerHTML = '<span class="cvLabelColorLoading"></span>';
			
			if(!s.htmlName){
			var tempP = s.htmlIcon;
			var fixP = null,fixScrollX = 0,fixScrollY = 0;
			while(RD_RESUMELABEL.Dom.getCurrentStyle(tempP,'overflowX')!='auto'&&RD_RESUMELABEL.Dom.getCurrentStyle(tempP,'overflowX')!='scroll'&&RD_RESUMELABEL.Dom.getCurrentStyle(tempP,'overflowY')!='auto'&&RD_RESUMELABEL.Dom.getCurrentStyle(tempP,'overflowY')!='scroll'){
				if(tempP.parentNode&&tempP.parentNode.tagName.toLowerCase()!='html') tempP = tempP.parentNode;
				else break;
			}
			if(tempP.tagName.toLowerCase()!='html') fixP = tempP;
			if(fixP!=null){
				fixScrollX = fixP.scrollLeft;
				fixScrollY = fixP.scrollTop;
			}
			
			s.divX = RD_RESUMELABEL.Dom.getLocalOffset(s.htmlIcon,'Left')+s.htmlIcon.offsetWidth+5-fixScrollX;
			s.divY = RD_RESUMELABEL.Dom.getLocalOffset(s.htmlIcon,'Top')-fixScrollY;
			/*RD_RESUMELABEL.dhtml_one.style.left = s.divX + 'px';
			RD_RESUMELABEL.dhtml_one.style.top = s.divY + 'px';
			RD_RESUMELABEL.dhtml_one.style.visibility = 'visible';
			if(RD_RESUMELABEL.shim){
				RD_RESUMELABEL.shim.style.left = RD_RESUMELABEL.dhtml_one.currentStyle.left;
				RD_RESUMELABEL.shim.style.top = RD_RESUMELABEL.dhtml_one.currentStyle.top;
				RD_RESUMELABEL.shim.style.width = RD_RESUMELABEL.dhtml_one.offsetWidth;
				RD_RESUMELABEL.shim.style.height = RD_RESUMELABEL.dhtml_one.offsetHeight;
				RD_RESUMELABEL.shim.style.visibility = 'visible';
			}*/
			}
			else{
				s.divX = e.clientX+parseFloat(document.documentElement.scrollLeft||document.body.scrollLeft);
				s.divY = e.clientY+parseFloat(document.documentElement.scrollTop||document.body.scrollTop);
			}
			showPopup(RD_RESUMELABEL.dhtml_one.id,e,s.divX,s.divY);
			if(parseInt(getCurrentStyle(RD_RESUMELABEL.dhtml_one,'left'))!=parseInt(s.divX)) positionObject(RD_RESUMELABEL.dhtml_one.id,s.divX,s.divY);
			
			if(RD_RESUMELABEL.dhtml_one.style.visibility!='hidden'){
				RD_RESUMELABEL.nowSetLabelCV = s;
				s.genDivHTML();
			}
			else RD_RESUMELABEL.nowSetLabelCV = null;
		}
	},
	genDivHTML : function(){
		var s = this;
		if(s.status=='ajax') return;
		else{
			if(RD_RESUMELABEL.itemsCustom==null){
				//if(!RD_RESUMELABEL.flagAJAXgetLabels){
					if(RD_RESUMELABEL.statusAJAXGetLabels=='ajax') return;
					RD_RESUMELABEL.statusAJAXGetLabels='ajax';
					var data = 'OptType=3' + '&t=' + new Date().getTime();
					submitCallback(data,'http://rd2.zhaopin.com/s/resuadmi/ajx_company_label.asp',RD_RESUMELABEL.handleGetCVLabelsResponse,'get');
			
					//setTimeout(function(){ajaxResponseLabelTest(data,'XXX.asp',RD_RESUMELABEL.handleGetCVLabelsResponse,'get')},1000);
				//}
			}
			else{
				RD_RESUMELABEL.ajaxDhtml_one.innerHTML = s.genCVLabelHTML();
				if(RD_RESUMELABEL.dhtml_one.shim) RD_RESUMELABEL.dhtml_one.shim.setStyle('visibility','visible');
			}
		}
	},
	genCVLabelHTML : function(){
		var s = this;
		var str = '<table cellpadding="2" cellspacing="2" border="0">',labelItems = RD_RESUMELABEL.items;
		var i,data,lId,lText,lClass,itemIndex=-1;
		for(i=0;labelItems[i];i++){
			data = labelItems[i].split(RD_RESUMELABEL.dataSepa);
			lId = data[0];
			lText = data[1];
			lClass = data[2];
			if(s.labelid == lId) continue;
			itemIndex++;
			if(itemIndex%s.col==0) str += '<tr>';
			str += '<td><span class="cvLabelColorDot"><span class="'+lClass+'" onclick="RD_RESUMELABEL.fnSubmitSetCVLabel(\''+s.resumeid+'\',\''+s.id+'\',\''+lId+'\')" title="'+lText+'"></span></span></td>';
			if(itemIndex%s.col==s.col-1) str += '</tr>';
		}
		while(itemIndex<s.col-1){
			str += '<td></td>';
			if(++itemIndex==s.col-1) str += '</tr>';
		}
		str += '</table>';
		if(s.labelid!=""&&s.labelid!="0") str += '<div style="border-top:#afbfd7 1px solid;padding-top:3px;margin-top:3px;"><a href="#" onclick="RD_RESUMELABEL.fnSubmitSetCVLabel(\''+s.resumeid+'\',\''+s.id+'\',\'0\');return false;">删除标签</a></div>';
		return str;
	},
	setAJAXLoadingClass : function(){
		var s = this;
		//if(s.html.onclick) s.fnOnClick = s.html.onclick;
		s.htmlIcon.className = 'cvLabelColorLoading';
		s.html.title = '正在添加标签，请稍等...';
		s.html.onclick = null;
		s.html.onmouseover = null;
		s.html.onmouseout = null;
		s.html.style.cursor = 'default';
		if(s.htmlName) s.htmlName.nodeValue = '';
	},
	setClass : function(){
		var s = this;
		s.htmlIcon.className = s.classN;
		s.html.title = s.title;
		s.html.onclick = s.fnOnClick;
		s.html.onmouseover = s.fnOver;
		s.html.onmouseout = s.fnOut;
		s.html.style.cursor = 'pointer';
		if(s.htmlName) s.htmlName.nodeValue = s.labelid=="0"?s.title:"("+s.title+")";
	}
}
function ajaxResponseLabelTest(a,b,c,d,e){
	c(true,'ok:cvlabel3,自定义,cvLabelColor2,cvlabel4,自定义2,cvLabelColor3',e);
}

RD_RESUMELABEL.handleGetCVLabelsResponse = function(success,responseText,objPar){
	RD_RESUMELABEL.statusAJAXGetLabels='ok';
	if(success){
		var indexS = responseText.indexOf(':');
		var flag = indexS>-1?responseText.substring(0,indexS).toLowerCase():'';
		var responseStr = indexS>-1?responseText.substring(indexS+1):'';
		if(flag=='ok'){
			RD_RESUMELABEL.itemsCustom = responseStr;
			RD_RESUMELABEL.fixLabelItems();
			//RD_RESUMELABEL.flagAJAXgetLabels = true;
		}
	}
	if(RD_RESUMELABEL.dhtml_one && RD_RESUMELABEL.dhtml_one.style.visibility!='hidden' && RD_RESUMELABEL.nowSetLabelCV!=null){
		if(success){
			switch(flag){
				case 'ok' : RD_RESUMELABEL.ajaxDhtml_one.innerHTML = RD_RESUMELABEL.nowSetLabelCV.genCVLabelHTML();break;
				case 'error' : if(responseStr!='') RD_RESUMELABEL.ajaxDhtml_one.innerHTML = responseStr;
							   else RD_RESUMELABEL.ajaxDhtml_one.innerHTML = '出错，请稍候再试！';break;
				default : RD_RESUMELABEL.ajaxDhtml_one.innerHTML = '出错，请稍候再试！';break;
			}
		}
		else{// something went wrong with the AJAX callback
			RD_RESUMELABEL.ajaxDhtml_one.innerHTML = 'AJAX出错，请稍候再试！';
		}
		if(RD_RESUMELABEL.dhtml_one.shim) RD_RESUMELABEL.dhtml_one.shim.setStyle('visibility','visible');
	}
	if(RD_RESUMELABEL.dhtml_more && RD_RESUMELABEL.dhtml_more.style.visibility!='hidden' && RD_RESUMELABEL.nowSetMoreLabel!=null){
		if(success){
			switch(flag){
				case 'ok' : RD_RESUMELABEL.dhtml_moreContent.innerHTML = RD_RESUMELABEL.nowSetMoreLabel[(objPar=='addLabel2CV'?'genCVLabelHTML':'genCVLabelEditHTML')]();break;
				case 'error' : if(responseStr!='') RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info">'+responseStr+'</div>';
							   else RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info">出错，请稍候再试！</div>';break;
				default : RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info">出错，请稍候再试！</div>';break;
			}
		}
		else{// something went wrong with the AJAX callback
			RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info">AJAX出错，请稍候再试！</div>';
		}
		if(RD_RESUMELABEL.dhtml_moreClose.style.display!='none') RD_RESUMELABEL.dhtml_moreClose.style.display = '';
		if(RD_RESUMELABEL.dhtml_more.shim) RD_RESUMELABEL.dhtml_more.shim.setStyle('visibility','visible');
	}
}

RD_RESUMELABEL.fnSubmitSetCVLabel = function(rId,oId,label){
	var o = RD_RESUMELABEL.allInstance[oId];
	//RD_RESUMELABEL.hideLabelDiv();
	hideCurrentPopup();
	if(o.status=='ajax') return;
	o.status = 'ajax';
	RD_RESUMELABEL.nowSetLabelCV = null;
	o.setAJAXLoadingClass();
	var data = 'OptType=1&IDs='+rId+'&LabelID='+label + '&t=' + new Date().getTime();
	submitCallback(data,'http://rd2.zhaopin.com/s/resuadmi/ajx_company_label.asp',RD_RESUMELABEL.handleSetCVLabelResponse,'get',[o,label]);
	
	ajaxResponseVar = label;
	//setTimeout(function(){ajaxResponseTest(data,'XXX.asp',RD_RESUMELABEL.handleSetCVLabelResponse,'get',o)},1000);
}
var ajaxResponseVar = '';
function ajaxResponseTest(a,b,c,d,e){
	var responseTxt = '';
	switch(ajaxResponseVar){
		case '1' : responseTxt = 'ok:1,待定,cvLabelWaiting';break;
		case '2' : responseTxt = 'ok:2,不符合职位要求,cvLabelnoPass';break;
		case '3' : responseTxt = 'ok:3,等待通知面试,cvLabelPass';break;
		default : responseTxt = 'error:';break;
	}
	c(true,responseTxt,e);
}

RD_RESUMELABEL.handleSetCVLabelResponse = function(success,responseText,objPar){
	//objPar[0].htmlIcon.className = objPar[0].classN;
	//objPar[0].html.title = objPar[0].title;
	//objPar[0].html.onclick = objPar[0].fnOnClick;
	//objPar[0].html.style.cursor = 'pointer';
	objPar[0].status = 'ok';
	var cvName = objPar[0].html.getAttribute('cvname')||'';
	if(success){
		var indexS = responseText.indexOf(':');
		var flag = indexS>-1?responseText.substring(0,indexS).toLowerCase():'';
		var responseStr = indexS>-1?responseText.substring(indexS+1):'';
		switch(flag){
			case 'ok' : var data = [];
						if(responseStr!='') data = responseStr.split(RD_RESUMELABEL.dataSepa);
						else{
							var labelId = objPar[1];
							if(labelId=="0") data = ["0","添加标签","cvLabelBlank"];
							else for(var i=0;RD_RESUMELABEL.items[i];i++){
								if(RD_RESUMELABEL.items[i].indexOf(objPar[1]+RD_RESUMELABEL.dataSepa)==0){
									data = RD_RESUMELABEL.items[i].split(RD_RESUMELABEL.dataSepa);
									break;
								}
							}
						}
						if(data.length){
							objPar[0].classN = data[2];
							objPar[0].labelid = data[0];
							objPar[0].title = data[1];
							objPar[0].html.setAttribute('label',data[0]);
							if(data[0]=="0"){
								objPar[0].fnOver = objPar[0].fnMouseOver;
								objPar[0].fnOut = objPar[0].fnMouseOut;
								RD_RESUMELABEL.showAJAXErrInfo('已成功为 '+cvName+' 的简历去除了标签');
							}
							else{
								objPar[0].fnOver = null;
								objPar[0].fnOut = null;
								RD_RESUMELABEL.showAJAXErrInfo('已成功为 '+cvName+' 的简历添加了标签：'+RD_RESUMELABEL.Dom.encode.html(data[1]));
							}
						}
						break;
			case 'error' : if(responseStr!='') RD_RESUMELABEL.showAJAXErrInfo(responseStr);
						   else RD_RESUMELABEL.showAJAXErrInfo('为 '+cvName+' 的简历添加标签出错，请稍候再试！');
						   RD_RESUMELABEL.fnGetCustomLabel();break;
			default : RD_RESUMELABEL.showAJAXErrInfo('为 '+cvName+' 的简历添加标签出错，请稍候再试！');break;
		}
	}else{// something went wrong with the AJAX callback
		RD_RESUMELABEL.showAJAXErrInfo('为 '+cvName+' 的简历添加标签时，AJAX出错，请稍候再试！');
	}
	objPar[0].setClass();
}

RD_RESUMELABEL.showAJAXErrInfo = function(txt){
	if(RD_RESUMELABEL.errCon && RD_RESUMELABEL.errCon.nodeType==1){
		if(RD_RESUMELABEL.showAJAXResInfTimer!=null){
			clearTimeout(RD_RESUMELABEL.showAJAXResInfTimer);
			RD_RESUMELABEL.showAJAXResInfTimer=null;
		}
		RD_RESUMELABEL.errCon.innerHTML = txt;
		RD_RESUMELABEL.showAJAXResInfTimer = setTimeout('RD_RESUMELABEL.hideAJAXErrInfo()',10000);
	}
}
RD_RESUMELABEL.hideAJAXErrInfo = function(){
	if(RD_RESUMELABEL.errCon && RD_RESUMELABEL.errCon.nodeType==1){
		RD_RESUMELABEL.errCon.innerHTML = '';
		if(RD_RESUMELABEL.showAJAXResInfTimer!=null){
			clearTimeout(RD_RESUMELABEL.showAJAXResInfTimer);
			RD_RESUMELABEL.showAJAXResInfTimer=null;
		}
	}
}

//RD_RESUMELABEL.Dom.myAttachEvent(window,'load',RD_RESUMELABEL.fnInitCVListTab);
//RD_RESUMELABEL.Dom.myAttachEvent(document,'click',RD_RESUMELABEL.hideLabelDiv);


RD_RESUMELABEL.cvLabelMoreFac = function(h){
	var s = this;
	s.html = h;
	s.id = s.html.id;
	s.cvStr = s.html.getAttribute('cvbox')||'';
	s.cv = (s.cvStr!=''&&eval(s.cvStr))?eval(s.cvStr):null;
	RD_RESUMELABEL.Dom.myAttachEvent(s.html,'click',function(e){s.fnClick(e);});
}
RD_RESUMELABEL.cvLabelMoreFac.prototype = {
	fnClick : function(e){
		var s = this;
		
		cancelBubble(e);
		
		if(!document.all){
			if(document.getElementById("floatbar")) document.getElementById("floatbar").style.visibility = "hidden";
		}
		
		if(!RD_RESUMELABEL.dhtml_more) RD_RESUMELABEL.dhtml_more =  RD_RESUMELABEL.buildPopDivMore();
		
		if(RD_RESUMELABEL.dhtml_more){
			RD_RESUMELABEL.dhtml_moreTitle.innerHTML = '添加标签：';
			RD_RESUMELABEL.dhtml_moreTitle.style.display = '';
			RD_RESUMELABEL.dhtml_moreClose.style.display = RD_RESUMELABEL.statusAJAXSetLabels=='ajax'?'none':'';
			RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info"><span class="cvLabelColorLoading"></span>'+(RD_RESUMELABEL.statusAJAXSetLabels=='ajax'?'正在为选中的简历添加标签，请稍候...':'正在加载简历标签，请稍等...')+'</div>';
			RD_RESUMELABEL.dhtml_moreContent.style.display = '';
			
			/*var tempP = s.html;
			var fixP = null,fixScrollX = 0,fixScrollY = 0;
			while(RD_RESUMELABEL.Dom.getCurrentStyle(tempP,'overflowX')!='auto'&&RD_RESUMELABEL.Dom.getCurrentStyle(tempP,'overflowX')!='scroll'&&RD_RESUMELABEL.Dom.getCurrentStyle(tempP,'overflowY')!='auto'&&RD_RESUMELABEL.Dom.getCurrentStyle(tempP,'overflowY')!='scroll'){
				if(tempP.parentNode&&tempP.parentNode.tagName.toLowerCase()!='html') tempP = tempP.parentNode;
				else break;
			}
			if(tempP.tagName.toLowerCase()!='html') fixP = tempP;
			if(fixP!=null){
				fixScrollX = fixP.scrollLeft;
				fixScrollY = fixP.scrollTop;
			}
			s.divX = RD_RESUMELABEL.Dom.getLocalOffset(s.html,'Left')-fixScrollX;
			s.divY = RD_RESUMELABEL.Dom.getLocalOffset(s.html,'Top')-fixScrollY;*/
			
			switchVisibility(RD_RESUMELABEL.dhtml_more.id,e,null,100+parseFloat(document.documentElement.scrollTop||document.body.scrollTop));
			
			if(RD_RESUMELABEL.dhtml_more.style.visibility!='hidden'){
				RD_RESUMELABEL.nowSetMoreLabel = s;
				s.genDivHTML();
				
				if(typeof(windowMask)=='function'){
					if(!document.body.mask) document.body.mask = new windowMask(document.body);
					if(document.body.mask.maskFlag) return true;
					document.body.mask.showMask();
				}
			}
			else RD_RESUMELABEL.nowSetMoreLabel = null;
		}
	},
	genDivHTML : function(info){
		var s = this;
		if(RD_RESUMELABEL.statusAJAXEditLabel=='ajax') return;
		RD_RESUMELABEL.dhtml_moreTitle.innerHTML = '添加标签：';
		RD_RESUMELABEL.dhtml_moreTitle.style.display = '';
		RD_RESUMELABEL.dhtml_moreClose.style.display = '';
		RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info"><span class="cvLabelColorLoading"></span>正在加载简历标签，请稍等...</div>';
		RD_RESUMELABEL.dhtml_moreContent.style.display = '';
		if(RD_RESUMELABEL.itemsCustom==null){
			//if(!RD_RESUMELABEL.flagAJAXgetLabels){
				if(RD_RESUMELABEL.statusAJAXGetLabels=='ajax') return;
				RD_RESUMELABEL.statusAJAXGetLabels='ajax';
				var data = 'OptType=3' + '&t=' + new Date().getTime();
				submitCallback(data,'http://rd2.zhaopin.com/s/resuadmi/ajx_company_label.asp',RD_RESUMELABEL.handleGetCVLabelsResponse,'get','addLabel2CV');
			
				//setTimeout(function(){ajaxResponseLabelTest(data,'XXX.asp',RD_RESUMELABEL.handleGetCVLabelsResponse,'get','addLabel2CV')},1000);
			//}
		}
		else{
			RD_RESUMELABEL.dhtml_moreContent.innerHTML = s.genCVLabelHTML(info);
			if(RD_RESUMELABEL.dhtml_moreClose.style.display!='none') RD_RESUMELABEL.dhtml_moreClose.style.display = '';
			if(RD_RESUMELABEL.dhtml_more.shim) RD_RESUMELABEL.dhtml_more.shim.setStyle('visibility','visible');
		}
	},
	genCVLabelHTML : function(info){
		var s = this;
		var str = '',labelItems = RD_RESUMELABEL.items;
		var i,data,lId,lText,lClass;
		str += '<div class="popupDivCon_Content">';
		if(info && typeof info=='string') str += '<div class="info">'+info+'</div>';
		str += '<ul class="labelList">';
		for(i=0;labelItems[i];i++){
			data = labelItems[i].split(RD_RESUMELABEL.dataSepa);
			lId = data[0];
			lText = data[1];
			lClass = data[2];
			str += '<li class="mouseout" onmouseover="RD_RESUMELABEL.changeLiClass(this,\'over\')" onmouseout="RD_RESUMELABEL.changeLiClass(this,\'out\')" onclick="RD_RESUMELABEL.fnSubmitSetCVLabel_more(\''+s.id+'\',\''+lId+'\')"><span class="cvLabelColorDot"><span class="'+lClass+'" title="'+lText+'"></span></span>'+RD_RESUMELABEL.Dom.encode.html(lText)+'</li>';
		}
		str += '</ul>';
		str += '<div class="rightLinks"><a href="javascript:RD_RESUMELABEL.allInstance[\''+s.id+'\'].showEditLabel()">增加/管理新标签</a></div></div>';
		return str;
	},
	genCVLabelEditHTML : function(){
		var s = this;
		var str = '';
		str += '<div class="popupDivCon_Content"><input type="hidden" name="customLabelDelStr" id="customLabelDelStr" value=""><ul id="cvLabelList">';
		var arrCLabel = RD_RESUMELABEL.items.slice(RD_RESUMELABEL.itemsDefault.length);
		if(arrCLabel.length){
			var i,data;
			for(i=0;arrCLabel[i];i++){
				data = arrCLabel[i].split(RD_RESUMELABEL.dataSepa);
				str += '<li id="customLabelItem'+i+'"><div class="nameCon"><input type="text" name="customLabelName'+i+'" id="customLabelName'+i+'" size="20" value="'+RD_RESUMELABEL.Dom.encode.htmlValue(data[1])+'" maxlength="40" labelid="'+data[0]+'" labelclass="'+data[2]+'"></div><div class="colorCon"><span class="cvLabelColorDot" title="修改颜色"><span id="customLabelClass'+i+'" class="'+data[2]+'" onclick="RD_RESUMELABEL.showAllCustomLabel(event,\'customLabelClass'+i+'\',\'customLabelName'+i+'\')"></span></span></div><div style="float:left;"><a href="#" onclick="RD_RESUMELABEL.showAllCustomLabel(event,\'customLabelClass'+i+'\',\'customLabelName'+i+'\');return false;">改颜色</a></div><div class="deleteCon"><img src="http://rd2.zhaopin.com/s/images/erd2/blank.gif" class="delCVLabel" title="删除标签" onclick="RD_RESUMELABEL.delCustomLabel(\'customLabelItem'+i+'\',\'customLabelName'+i+'\')"></div></li>';
			}
		}
		str += '</ul><div id="newCustomLabelTrigger" style="margin-top:5px;display:'+(arrCLabel.length==RD_RESUMELABEL.maxCustomLabel?'none':'')+';"><a href="javascript:RD_RESUMELABEL.newCustomLabel()" title="新建标签" onfocus="this.blur()">+新标签</a></div><div style="display:'+(arrCLabel.length==RD_RESUMELABEL.maxCustomLabel?'':'none')+';color:#666;" id="addLabelMaxTip">您最多可添加'+RD_RESUMELABEL.maxCustomLabel+'个标签</div></div>';
		str += '<div class="popupDivButton"><input type="button" name="saveLabel" value="确定" class="genButton1 pcb" onClick="RD_RESUMELABEL.fnSubmitEditCVLabel(\''+s.id+'\');RD_RESUMELABEL.hideAllCustomLabel();">&nbsp;&nbsp;<input type="button" name="cancelLabel" value="取消" class="genButton1 pcb" onClick="RD_RESUMELABEL.allInstance[\''+s.id+'\'].genDivHTML();RD_RESUMELABEL.hideAllCustomLabel();"></div>';
		return str;
	},
	showEditLabel : function(){
		var s = this;
		if(RD_RESUMELABEL.statusAJAXSetLabels=='ajax' || RD_RESUMELABEL.statusAJAXEditLabel=='ajax') return;
		RD_RESUMELABEL.dhtml_moreTitle.innerHTML = '全部新标签：';
		RD_RESUMELABEL.dhtml_moreTitle.style.display = '';
		RD_RESUMELABEL.dhtml_moreClose.style.display = '';
		RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info"><span class="cvLabelColorLoading"></span>正在加载简历标签，请稍等...</div>';
		RD_RESUMELABEL.dhtml_moreContent.style.display = '';
		if(RD_RESUMELABEL.itemsCustom==null){
			//if(!RD_RESUMELABEL.flagAJAXgetLabels){
				if(RD_RESUMELABEL.statusAJAXGetLabels=='ajax') return;
				RD_RESUMELABEL.statusAJAXGetLabels='ajax';
				var data = 'OptType=3' + '&t=' + new Date().getTime();
				submitCallback(data,'http://rd2.zhaopin.com/s/resuadmi/ajx_company_label.asp',RD_RESUMELABEL.handleGetCVLabelsResponse,'get','editLabels');
			
				//setTimeout(function(){ajaxResponseLabelTest(data,'XXX.asp',RD_RESUMELABEL.handleGetCVLabelsResponse,'get','editLabels')},1000);
			//}
		}
		else{
			RD_RESUMELABEL.dhtml_moreContent.innerHTML = s.genCVLabelEditHTML();
			if(RD_RESUMELABEL.dhtml_moreClose.style.display!='none') RD_RESUMELABEL.dhtml_moreClose.style.display = '';
			if(RD_RESUMELABEL.dhtml_more.shim) RD_RESUMELABEL.dhtml_more.shim.setStyle('visibility','visible');
		}
	}
};

RD_RESUMELABEL.labelNameErrInfo = ['标签名称不能为空！','标签名称最多输入20个字！','标签名称不能含有半角逗号和尖括号！'];
RD_RESUMELABEL.fnCheckCustomLabelName = function(txt){
	var trimTxt = txt.trimAll();
	if(trimTxt=='') return 0;
	if(trimTxt.search(/,|<|>/gi)>-1) return 2;
	if(trimTxt.length>20) return 1;//fixLength
	return 'ok';
};

RD_RESUMELABEL.fnSubmitEditCVLabel = function(oId){
	var o = RD_RESUMELABEL.allInstance[oId];
	var ul = document.getElementById('cvLabelList');
	if(ul){
		var newLabelStr = '',oneLabelStr,checkNameInfo;
		var inputLabel = ul.getElementsByTagName('input');
		var classStr = '';
		for(var i=0;inputLabel[i];i++){
			if(inputLabel[i].getAttribute('type').toLowerCase()=='text'){
				checkNameInfo = RD_RESUMELABEL.fnCheckCustomLabelName(inputLabel[i].value);
				if(checkNameInfo!='ok'&&RD_RESUMELABEL.labelNameErrInfo[checkNameInfo]){
					alert(RD_RESUMELABEL.labelNameErrInfo[checkNameInfo]);
					inputLabel[i].focus();
					return;
				}
				if(inputLabel[i].getAttribute('labelclass')){
					if(classStr!=""){
						if(classStr.indexOf("|"+inputLabel[i].getAttribute('labelclass')+"|")>-1){
							alert("标签颜色不能重复！");
							return;
						}
					}
					classStr += (classStr==""?"|":"")+inputLabel[i].getAttribute('labelclass')+"|";
				}
				
				oneLabelStr = (inputLabel[i].getAttribute('labelid')||'')+RD_RESUMELABEL.dataSepa+RD_RESUMELABEL.Dom.encode.url(inputLabel[i].value)+RD_RESUMELABEL.dataSepa+(inputLabel[i].getAttribute('labelclass')||'');
				newLabelStr += newLabelStr==''?oneLabelStr:RD_RESUMELABEL.dataSepa+oneLabelStr;
			}
		}
		RD_RESUMELABEL.statusAJAXEditLabel = 'ajax';
		var delLabel = document.getElementById('customLabelDelStr').value;
		var data = 'OptType=2&Value_New='+newLabelStr+'&Value_Old='+RD_RESUMELABEL.Dom.encode.url(RD_RESUMELABEL.itemsCustom).replace(/%2c/gi,",")+'&Value_Del='+delLabel+'&GetLabelList=1' + '&t=' + new Date().getTime();
		
		RD_RESUMELABEL.dhtml_moreClose.style.display = 'none';
		RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info"><span class="cvLabelColorLoading"></span>正在更新简历标签，请稍等...</div>';
		if(RD_RESUMELABEL.dhtml_more.shim) RD_RESUMELABEL.dhtml_more.shim.setStyle('visibility','visible');
		submitCallback(data,'http://rd2.zhaopin.com/s/resuadmi/ajx_company_label.asp',RD_RESUMELABEL.handleEditCVLabelResponse,'get',o);
	
		ajaxResponseVar2 = newLabelStr;
		//setTimeout(function(){ajaxResponseTestEdit(data,'XXX.asp',RD_RESUMELABEL.handleEditCVLabelResponse,'get',o)},1000);
	}


	else return;
}
var ajaxResponseVar2;
function ajaxResponseTestEdit(a,b,c,d,e){
	var responseTxt = 'ok:'+ajaxResponseVar2;
	c(true,responseTxt,e);
}

RD_RESUMELABEL.handleEditCVLabelResponse = function(success,responseText,objPar){
	RD_RESUMELABEL.statusAJAXEditLabel = 'ok';
	var info = '';
	if(success){
		var indexS = responseText.indexOf(':');
		var flag = indexS>-1?responseText.substring(0,indexS).toLowerCase():'';
		var responseStr = indexS>-1?responseText.substring(indexS+1):'';
		switch(flag){
			case 'ok' : RD_RESUMELABEL.itemsCustom = responseStr;
						RD_RESUMELABEL.fixLabelItems();
						info = '标签已成功更新！';break;
			case 'error' : if(responseStr!='') info = responseStr;
						   else info = '出错，请稍候再试！';break;
			default : info = '出错，请稍候再试！';break;
		}
	}else{// something went wrong with the AJAX callback
		info = 'AJAX出错，请稍候再试！';
	}
	objPar.genDivHTML(info);
	
	var fixAllLabelIdStr = RD_RESUMELABEL.dataSepa + RD_RESUMELABEL.items.join(RD_RESUMELABEL.dataSepa) + RD_RESUMELABEL.dataSepa;
	var fixItemLabelIdStr = '';
	var labelItem,startIndex,subLabelIdStr,tempArr;
	for(var i in RD_RESUMELABEL.allInstance){
		labelItem = RD_RESUMELABEL.allInstance[i];
		if(labelItem.resumeid){
			fixItemLabelIdStr = RD_RESUMELABEL.dataSepa + labelItem.labelid + RD_RESUMELABEL.dataSepa;
			if(fixAllLabelIdStr.indexOf(fixItemLabelIdStr)>-1){
				startIndex = fixAllLabelIdStr.indexOf(fixItemLabelIdStr);
				subLabelIdStr = fixAllLabelIdStr.substring(startIndex+1);
				tempArr = subLabelIdStr.split(RD_RESUMELABEL.dataSepa);
				if(labelItem.classN != tempArr[2]){
					labelItem.htmlIcon.className = tempArr[2];
					labelItem.classN = tempArr[2];
				}
				if(labelItem.html.getAttribute('title')!=tempArr[1]){
					labelItem.html.setAttribute('title',tempArr[1]);
					labelItem.title = tempArr[1];
					if(labelItem.htmlName) labelItem.htmlName.nodeValue = "("+tempArr[1]+")";
				}
				labelItem.fnOver = null;
				labelItem.fnOut = null;
				labelItem.html.onmouseover = labelItem.fnOver;
				labelItem.html.onmouseout = labelItem.fnOut;
			}
			else{
				if(labelItem.htmlIcon.className!='cvLabelBlank'){
					labelItem.htmlIcon.className = 'cvLabelBlank';
					labelItem.classN = 'cvLabelBlank';
				}
				if(labelItem.html.getAttribute('title')!='添加标签'){
					labelItem.html.setAttribute('title','添加标签');
					labelItem.title = '添加标签';
					if(labelItem.htmlName) labelItem.htmlName.nodeValue = '添加标签';
				}
				labelItem.labelid = "0";
				labelItem.html.setAttribute('label',"0");
				labelItem.fnOver = labelItem.fnMouseOver;
				labelItem.fnOut = labelItem.fnMouseOut;
				labelItem.html.onmouseover = labelItem.fnOver;
				labelItem.html.onmouseout = labelItem.fnOut;
			}
		}
	}
}

RD_RESUMELABEL.getOkLabelClass = function(){
	var allCusClassStr = "|";
	var cusClassN = 12;
	for(var i=1;i<=cusClassN;i++) allCusClassStr += "cvLabelColor"+i+"|";
	var ul = document.getElementById('cvLabelList');
	var inputLabel = ul.getElementsByTagName('input');
	for(i=0;inputLabel[i];i++) if(inputLabel[i].getAttribute('type').toLowerCase()=='text'&&inputLabel[i].getAttribute('labelclass')) allCusClassStr = allCusClassStr.replace("|"+inputLabel[i].getAttribute('labelclass')+"|","|");
	return allCusClassStr.split("|")[1]||"cvLabelColor1";
}
RD_RESUMELABEL.newCustomLabel = function(){
	var ul = document.getElementById('cvLabelList');
	var uid = (new Date()).getTime()+Math.random().toString().substr(2,5);
	var newLi = document.createElement('li');
	newLi.id = 'customLabelItem' + uid;
	newLi.innerHTML = '<div class="nameCon"><input type="text" name="customLabelName'+uid+'" id="customLabelName'+uid+'" size="20" value="" maxlength="40" labelid="" labelclass="'+RD_RESUMELABEL.getOkLabelClass()+'"></div><div class="colorCon"><span class="cvLabelColorDot" title="修改颜色"><span id="customLabelClass'+uid+'" class="'+RD_RESUMELABEL.getOkLabelClass()+'" onclick="RD_RESUMELABEL.showAllCustomLabel(event,\'customLabelClass'+uid+'\',\'customLabelName'+uid+'\')"></span></span></div><div style="float:left;" ><a href="#" onclick="RD_RESUMELABEL.showAllCustomLabel(event,\'customLabelClass'+uid+'\',\'customLabelName'+uid+'\');return false;">改颜色</a></div><div class="deleteCon"><img src="http://rd2.zhaopin.com/s/images/erd2/blank.gif" class="delCVLabel" title="删除标签" onclick="RD_RESUMELABEL.delCustomLabel(\'customLabelItem'+uid+'\',\'customLabelName'+uid+'\')"></div>';
	ul.appendChild(newLi);
	if(document.getElementById("customLabelName"+uid)) document.getElementById("customLabelName"+uid).focus();
	
	var addLabel = document.getElementById('newCustomLabelTrigger');
	var addInfo = document.getElementById('addLabelMaxTip');
	if(ul.childNodes.length==RD_RESUMELABEL.maxCustomLabel){
		addLabel.style.display = 'none';
		addInfo.style.display = '';
	}
	else{
		addLabel.style.display = '';
		addInfo.style.display = 'none';
	}
}

RD_RESUMELABEL.delCustomLabel = function(itemId,inputId){
	var labelItem = document.getElementById(itemId);
	if(labelItem){
		if(confirm('您确定要删除此标签吗？\n\n所有使用了该标签的简历将变为无标签状态。')){
			labelItem.parentNode.removeChild(labelItem);
			var inputItem = labelItem.getElementsByTagName('input')[0];
			var labelId = inputItem.getAttribute('labelid')||null;
			var delHidden = document.getElementById('customLabelDelStr')||null;
			if(labelId&&labelId!=''&&delHidden) delHidden.value += delHidden.value==''?labelId:RD_RESUMELABEL.dataSepa+labelId;
			var info = document.getElementById('addLabelMaxTip')||null;
			if(info&&info.style.display!='none') info.style.display = 'none';
			var addLabel = document.getElementById('newCustomLabelTrigger');
			if(addLabel&&addLabel.style.display=='none') addLabel.style.display = '';
			if(RD_RESUMELABEL.dhtml_more.shim) RD_RESUMELABEL.dhtml_more.shim.setStyle('visibility','visible');
		}
	}
}

RD_RESUMELABEL.showAllCustomLabel = function(e,spanId,inputId){
	cancelBubble(e);
	
	var span = document.getElementById(spanId);
	if(!RD_RESUMELABEL.dhtml_allCustomLabel) RD_RESUMELABEL.dhtml_allCustomLabel = (function(){
																							   var myDiv = document.createElement('div');
																							   myDiv.style.visibility = 'hidden';
												   											   myDiv.style.position = 'absolute';
												   											   myDiv.style.top = '-100px';
												   											   myDiv.style.left = '-100px';
												   											   myDiv.style.zIndex = '1001';
												   											   myDiv.className = 'popupDivCon';
																							   myDiv.id = 'cvLabelAllColorDiv';
																							   document.body.appendChild(myDiv);
												   											   myDiv.onclick = function(e){cancelBubble(e);};
																							   return myDiv;
																							   })();
	if(RD_RESUMELABEL.dhtml_allCustomLabel){
		var col = 6;
		var strHTML =  '<div class="popupDivCon_Content"><table cellpadding="2" cellspacing="2" border="0">';
		var i,colIndex;
		for(i=0;i<RD_RESUMELABEL.customLabelClass;){
			colIndex = i%col;
			if(colIndex==0) strHTML += '<tr>';
			i++;
			strHTML += '<td><span class="cvLabelColorDot"><span class="cvLabelColor'+i+'" onclick="RD_RESUMELABEL.setLabelClass(\'cvLabelColor'+i+'\',\''+spanId+'\',\''+inputId+'\')">'+('cvLabelColor'+i==span.className?'&radic;':'')+'</span></span></td>';
			if(colIndex==col-1) strHTML += '</tr>';
		}
		strHTML += '</table></div>';
		RD_RESUMELABEL.dhtml_allCustomLabel.innerHTML = strHTML;
		
		if(RD_RESUMELABEL.dhtml_allCustomLabel.currentStyle && navigator.userAgent.indexOf("MSIE 7") == -1){//ie6
			if(!RD_RESUMELABEL.dhtml_allCustomLabel.shim){
				var shim = document.createElement('iframe');
				shim.src = 'javascript:""';
            	shim.frameBorder = '0';
            	shim.scrolling = 'no';
            	shim.className = 'iframeShim';
            	shim.style.zIndex = RD_RESUMELABEL.dhtml_allCustomLabel.currentStyle.zIndex - 1;
				shim.style.position = 'absolute';
				shim.style.visibility = 'hidden';
				shim.style.width = parseFloat(RD_RESUMELABEL.dhtml_allCustomLabel.offsetWidth) + 'px';
				shim.style.height = parseFloat(RD_RESUMELABEL.dhtml_allCustomLabel.offsetHeight) + 'px';
				shim.style.left = RD_RESUMELABEL.Dom.getLocalOffset(RD_RESUMELABEL.dhtml_allCustomLabel,'Left');
				shim.style.top = RD_RESUMELABEL.Dom.getLocalOffset(RD_RESUMELABEL.dhtml_allCustomLabel,'Top');
				RD_RESUMELABEL.dhtml_allCustomLabel.shim = shim;
				RD_RESUMELABEL.dhtml_allCustomLabel.parentNode.appendChild(RD_RESUMELABEL.dhtml_allCustomLabel.shim);
			}
		}
		
		var pointer = {x:0,y:0};
		pointer.y = RD_RESUMELABEL.Dom.getLocalOffset(span,'Top');
		pointer.x = RD_RESUMELABEL.Dom.getLocalOffset(span,'Left');
		RD_RESUMELABEL.dhtml_allCustomLabel.style.top = pointer.y + span.offsetHeight + 'px';
		RD_RESUMELABEL.dhtml_allCustomLabel.style.left = pointer.x + 'px';
		RD_RESUMELABEL.dhtml_allCustomLabel.style.visibility = 'visible';
		if(RD_RESUMELABEL.dhtml_allCustomLabel.shim){
			RD_RESUMELABEL.dhtml_allCustomLabel.shim.style.top = RD_RESUMELABEL.dhtml_allCustomLabel.style.top;
			RD_RESUMELABEL.dhtml_allCustomLabel.shim.style.left = RD_RESUMELABEL.dhtml_allCustomLabel.style.left;
			RD_RESUMELABEL.dhtml_allCustomLabel.shim.style.visibility = 'visible';
		}
	}
};

RD_RESUMELABEL.hideAllCustomLabel = function(){
	if(RD_RESUMELABEL.dhtml_allCustomLabel&&RD_RESUMELABEL.Dom.getCurrentStyle(RD_RESUMELABEL.dhtml_allCustomLabel,'visibility')!='hidden'){
		RD_RESUMELABEL.dhtml_allCustomLabel.style.visibility = 'hidden';
		if(RD_RESUMELABEL.dhtml_allCustomLabel.shim) RD_RESUMELABEL.dhtml_allCustomLabel.shim.style.visibility = 'hidden';
	}
};

RD_RESUMELABEL.setLabelClass = function(newClass,spanId,inputId){
	var span = document.getElementById(spanId)||null;
	if(span) span.className = newClass;
	var input = document.getElementById(inputId)||null;
	if(input) input.setAttribute('labelclass',newClass);
	RD_RESUMELABEL.hideAllCustomLabel();
}



RD_RESUMELABEL.hideSetLabelMoreDiv = function(){
	if(RD_RESUMELABEL.dhtml_more&&RD_RESUMELABEL.Dom.getCurrentStyle(RD_RESUMELABEL.dhtml_more,'visibility')!='hidden'){
		window.flagHideCurPopup = false;
		hideCurrentPopup();
		moveObject(RD_RESUMELABEL.dhtml_more.id,-100,-100);
		if(typeof(windowMask)=='function'&&document.body.mask) document.body.mask.hideMask();
	}
	
	if(!document.all){
		if(document.getElementById("floatbar")) document.getElementById("floatbar").style.visibility = "visible";
	}
};

RD_RESUMELABEL.fnSubmitSetCVLabel_more = function(oId,label){
	var o = RD_RESUMELABEL.allInstance[oId];
	var cvIDStr = '',i,resumeid;
	RD_RESUMELABEL.cvIdAJAXSetLabels = [];
	if(o.cv!=null){
		if(o.cv.length){
			for(i=0;o.cv[i];i++){
				if(o.cv[i].checked){
					resumeid = o.cv[i].value.toString().indexOf("|")>-1?o.cv[i].value.split("|")[2]:o.cv[i].value;
					cvIDStr += cvIDStr==''?resumeid:RD_RESUMELABEL.dataSepa+resumeid;
					RD_RESUMELABEL.cvIdAJAXSetLabels.push(resumeid);
					if(RD_RESUMELABEL.allInstance["r_label"+resumeid]) RD_RESUMELABEL.allInstance["r_label"+resumeid].setAJAXLoadingClass();
				}
			}
		}
		else{
			if(o.cv.checked){
				resumeid = o.cv.value.toString().indexOf("|")>-1?o.cv.value.split("|")[2]:o.cv.value;
				cvIDStr = resumeid;
				RD_RESUMELABEL.cvIdAJAXSetLabels.push(resumeid);
				if(RD_RESUMELABEL.allInstance["r_label"+cvIDStr]) RD_RESUMELABEL.allInstance["r_label"+cvIDStr].setAJAXLoadingClass();
			}
		}
		if(cvIDStr==''){
			alert('请选择要添加标签的简历！');
		}
		else{
			if(RD_RESUMELABEL.statusAJAXSetLabels=='ajax') return;
			RD_RESUMELABEL.statusAJAXSetLabels = 'ajax';
			RD_RESUMELABEL.dhtml_moreClose.style.display = 'none';
			RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info"><span class="cvLabelColorLoading"></span>正在为选中的简历添加标签，请稍等...</div>';
			if(RD_RESUMELABEL.dhtml_more.shim) RD_RESUMELABEL.dhtml_more.shim.setStyle('visibility','visible');
			
			var data = 'OptType=1&IDs='+cvIDStr+'&LabelID='+label + '&t=' + new Date().getTime();
			submitCallback(data,'http://rd2.zhaopin.com/s/resuadmi/ajx_company_label.asp',RD_RESUMELABEL.handleSetCVLabelMoreResponse,'get',[RD_RESUMELABEL.cvIdAJAXSetLabels,label]);
	
			ajaxResponseVar = label;
			//setTimeout(function(){ajaxResponseTestMore(data,'XXX.asp',RD_RESUMELABEL.handleSetCVLabelMoreResponse,'get',RD_RESUMELABEL.cvIdAJAXSetLabels)},1000);
		}
		RD_RESUMELABEL.hideSetLabelMoreDiv();
	}
}
function ajaxResponseTestMore(a,b,c,d,e){
	var responseTxt = '';
	switch(ajaxResponseVar){
		case '1' : responseTxt = 'ok:1,待定,cvLabelWaiting';break;
		case '2' : responseTxt = 'ok:2,不符合职位要求,cvLabelnoPass';break;
		case '3' : responseTxt = 'ok:3,等待通知面试,cvLabelPass';break;
		default : responseTxt = 'error:';break;
	}
	c(true,responseTxt,e);
}

RD_RESUMELABEL.fnSubmitDelCVLabel_more = function(o){
	var cvIDStr = '',i;
	RD_RESUMELABEL.cvIdAJAXDelLabels = [];
	if(o.cv!=null){
		if(o.cv.length){
			for(i=0;o.cv[i];i++){
				if(o.cv[i].checked){
					resumeid = o.cv[i].value.toString().indexOf("|")>-1?o.cv[i].value.split("|")[2]:o.cv[i].value;
					cvIDStr += cvIDStr==''?resumeid:RD_RESUMELABEL.dataSepa+resumeid;
					RD_RESUMELABEL.cvIdAJAXDelLabels.push(resumeid);
					if(RD_RESUMELABEL.allInstance["r_label"+resumeid]) RD_RESUMELABEL.allInstance["r_label"+resumeid].setAJAXLoadingClass();
				}
			}
		}
		else{
			if(o.cv.checked){
				resumeid = o.cv.value.toString().indexOf("|")>-1?o.cv.value.split("|")[2]:o.cv.value;
				cvIDStr = resumeid;
				RD_RESUMELABEL.cvIdAJAXDelLabels.push(resumeid);
				if(RD_RESUMELABEL.allInstance["r_label"+cvIDStr]) RD_RESUMELABEL.allInstance["r_label"+cvIDStr].setAJAXLoadingClass();
			}
		}
		if(cvIDStr==''){
			alert('请选择要删除标签的简历！');
		}
		else{
			if(RD_RESUMELABEL.statusAJAXSetLabels=='ajax') return;
			RD_RESUMELABEL.statusAJAXSetLabels = 'ajax';
			
			var data = 'OptType=1&IDs='+cvIDStr+'&LabelID=0&t=' + new Date().getTime();
			submitCallback(data,'http://rd2.zhaopin.com/s/resuadmi/ajx_company_label.asp',RD_RESUMELABEL.handleDelCVLabelMoreResponse,'get',RD_RESUMELABEL.cvIdAJAXDelLabels);
	
			ajaxResponseVar = 0;
		}
		hideCurrentPopup();
	}
}

RD_RESUMELABEL.handleDelCVLabelMoreResponse = function(success,responseText,objPar){
	RD_RESUMELABEL.statusAJAXSetLabels = 'ok';
	if(success){
		var indexS = responseText.indexOf(':');
		var flag = indexS>-1?responseText.substring(0,indexS).toLowerCase():'';
		var responseStr = indexS>-1?responseText.substring(indexS+1):'';
		var labelObj = [],i;
		for(i=0;i<objPar.length;i++) if(RD_RESUMELABEL.allInstance['r_label'+objPar[i]]) labelObj.push(RD_RESUMELABEL.allInstance['r_label'+objPar[i]]);
		switch(flag){
			case 'ok' : for(i=0;labelObj[i];i++){
							labelObj[i].classN = "cvLabelBlank";
							labelObj[i].labelid = "0";
							labelObj[i].html.setAttribute('label',"0");
							labelObj[i].title = "添加标签";
							labelObj[i].fnOver = labelObj[i].fnMouseOver;
							labelObj[i].fnOut = labelObj[i].fnMouseOut;
						}
						RD_RESUMELABEL.showAJAXErrInfo('已成功为选中的'+labelObj.length+'个简历删除了标签');
						break;
			case 'error' : if(responseStr!='') RD_RESUMELABEL.showAJAXErrInfo(responseStr);
						   else RD_RESUMELABEL.showAJAXErrInfo('出错，请稍候再试！');break;
			default : RD_RESUMELABEL.showAJAXErrInfo('出错，请稍候再试！');break;
		}
	}else{// something went wrong with the AJAX callback
		RD_RESUMELABEL.showAJAXErrInfo('出错，请稍候再试！');
	}
	for(i=0;labelObj[i];i++) labelObj[i].setClass();
}

RD_RESUMELABEL.handleSetCVLabelMoreResponse = function(success,responseText,objPar){
	RD_RESUMELABEL.statusAJAXSetLabels = 'ok';
	if(success){
		var indexS = responseText.indexOf(':');
		var flag = indexS>-1?responseText.substring(0,indexS).toLowerCase():'';
		var responseStr = indexS>-1?responseText.substring(indexS+1):'';
		var labelObj = [],i;
		for(i=0;i<objPar[0].length;i++) if(RD_RESUMELABEL.allInstance['r_label'+objPar[0][i]]) labelObj.push(RD_RESUMELABEL.allInstance['r_label'+objPar[0][i]]);
		switch(flag){
			case 'ok' : var data = [];
						if(responseStr!='') data = responseStr.split(RD_RESUMELABEL.dataSepa);
						else{
							var labelId = objPar[1];
							if(labelId=="0") data = ["0","添加标签","cvLabelBlank"];
							else for(var i=0;RD_RESUMELABEL.items[i];i++){
								if(RD_RESUMELABEL.items[i].indexOf(objPar[1]+RD_RESUMELABEL.dataSepa)==0){
									data = RD_RESUMELABEL.items[i].split(RD_RESUMELABEL.dataSepa);
									break;
								}
							}
						}
						if(data.length){
							for(i=0;labelObj[i];i++){
								labelObj[i].classN = data[2];
								labelObj[i].labelid = data[0];
								labelObj[i].html.setAttribute('label',data[0]);
								labelObj[i].title = data[1];
								if(data[0]=="0"){
									labelObj[i].fnOver = labelObj[i].fnMouseOver;
									labelObj[i].fnOut = labelObj[i].fnMouseOut;
								}
								else{
									labelObj[i].fnOver = null;
									labelObj[i].fnOut = null;
								}
							}
							//RD_RESUMELABEL.dhtml_moreContent.innerHTML = '<div class="popupDivCon_Content info">已成功为选中的'+numCV+'个简历添加了标签：'+RD_RESUMELABEL.Dom.encode.html(data[1])+'</div>';
							if(data[0]=="0") RD_RESUMELABEL.showAJAXErrInfo('已成功为选中的'+labelObj.length+'个简历删除了标签');
							else RD_RESUMELABEL.showAJAXErrInfo('已成功为选中的'+labelObj.length+'个简历添加了标签：'+RD_RESUMELABEL.Dom.encode.html(data[1]));
							RD_RESUMELABEL.hideSetLabelMoreDiv();
						}
						break;
			case 'error' : if(responseStr!='') RD_RESUMELABEL.showAJAXErrInfo(responseStr);
						   else RD_RESUMELABEL.showAJAXErrInfo('出错，请稍候再试！');
						   RD_RESUMELABEL.fnGetCustomLabel();break;
			default : RD_RESUMELABEL.showAJAXErrInfo('出错，请稍候再试！');break;
		}
	}else{// something went wrong with the AJAX callback
		RD_RESUMELABEL.showAJAXErrInfo('出错，请稍候再试！');
	}
	//RD_RESUMELABEL.dhtml_moreClose.style.display = '';
	for(i=0;labelObj[i];i++) labelObj[i].setClass();
}

$regEventDomReady(RD_RESUMELABEL.fnInitCVListTab);

function windowMask(theObj){
    this.obj=theObj;
	this.obj.selectObj = [];
	var allSel = this.obj.getElementsByTagName('select');
	if(arguments[2]){
		var tempP;
		for(var i=0;allSel[i];i++){
			tempP = allSel[i].parentNode;
			while(tempP && tempP.tagName.toLowerCase()!='html'){
				if(tempP.id==arguments[2]) break;
				tempP = tempP.parentNode;
			}
			if(tempP.tagName.toLowerCase()=='html') this.obj.selectObj.push(allSel[i]);
		}
	}
	else this.obj.selectObj=this.obj.getElementsByTagName('select');
    var newDiv=document.createElement("div");
    newDiv.className="divMask";
    newDiv.style.zIndex=getCurrentStyle(this.obj,'zIndex')*1+2;
    var offsetLeft=getLocalOffsetLeft(this.obj);
    newDiv.style.left=offsetLeft;
    var offsetTop=getLocalOffsetTop(this.obj);
    newDiv.style.top=offsetTop;
	newDiv.style.width=this.obj.scrollWidth?this.obj.scrollWidth:this.obj.offsetWidth?this.obj.offsetWidth:this.obj.clientWidth;
    newDiv.style.height=this.obj.scrollHeight?this.obj.scrollHeight:this.obj.offsetHeight?this.obj.offsetHeight:this.obj.clientHeight;
	if(typeof(newDiv.style.filter)!='undefined') newDiv.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
	else newDiv.style.MozOpacity=0.7;
    newDiv.style.position="absolute";
	newDiv.style.visibility='hidden';
	newDiv.onclick = function(e){cancelBubble(e);};
	
	if(theObj.tagName.toLowerCase()!='body'){
		var id=this.obj.id;
		newDiv.onclick=function(){switchFocus(id);};
	}
	
    this.div=newDiv;
	this.maskFlag=false;
    if(this.obj.parentNode.tagName.toLowerCase()!='html') this.obj.parentNode.insertBefore(this.div,this.obj);
	else if(arguments[1]&&arguments[1].nodeType==1&&arguments[1].tagName.toLowerCase()!='body') arguments[1].appendChild(this.div);
	else document.body.appendChild(this.div);
	if(this.obj.currentStyle){//IE
        this.setOpacity=this.setOpacityIE;this.getOpacity=this.getOpacityIE;
    }else{//Non IE,just pass calls through
        this.setOpacity=this.setOpacityNonIE;this.getOpacity=this.getOpacityNonIE;
    }
}
windowMask.prototype={
    setStyle:function(prop,val){
                        this.obj.style[prop]=val;
                        if(prop != 'position'){//div must remain position:absolute
	                        this.div.style[prop]=val;
                        }//Refresh div's width and height from the browser calculated offsets.
                        if(this.obj.tagName.toLowerCase()=='body'){
							var screenHeight = screen.availHeight-144,screenWidth = screen.availWidth-20;
							var objHeight = this.obj.scrollHeight?this.obj.scrollHeight:this.obj.offsetHeight?this.obj.offsetHeight:this.obj.clientHeight;
	                    	this.div.style.height=Math.max(screenHeight,objHeight)+"px";
						}
						else{
	                    	this.div.style.height=(this.obj.scrollHeight?this.obj.scrollHeight:this.obj.offsetHeight?this.obj.offsetHeight:this.obj.clientHeight)+"px";
						}
						this.div.style.width=(this.obj.scrollWidth?this.obj.scrollWidth:this.obj.offsetWidth?this.obj.offsetWidth:this.obj.clientWidth)+"px";
	                    this.div.style.left=getLocalOffsetLeft(this.obj);
				        this.div.style.top=getLocalOffsetTop(this.obj);

                 },
	getStyle:function(prop) {return this.div.style[prop];},
    setOpacityNonIE:function(val){
                            if(val<0) val=0;if(val>1) val=1;
                            this.obj.style.opacity=val;
                      },
    setOpacityIE:function(val){
                        if(val<0) val=0;if(val>1) val=1;
                        this.obj.filters.alpha.opacity=(val*100); //div stays at opacity 0
                   },
    getOpacityNonIE:function(){return getCurrentStyle(this.obj,'opacity'); },
    getOpacityIE:function(){return this.obj.filters.alpha.opacity/100.0; },
	showMask2:function(){//Refresh div's width and height from the browser calculated offsets.
                        if(this.obj.tagName.toLowerCase()=='body'){
							var screenHeight = screen.availHeight-144,screenWidth = screen.availWidth-20;
							var objHeight = this.obj.scrollHeight?this.obj.scrollHeight:this.obj.offsetHeight?this.obj.offsetHeight:this.obj.clientHeight;
	                    	this.div.style.height=Math.max(screenHeight,objHeight)+"px";
						}
						else{
	                    	this.div.style.height=(this.obj.scrollHeight?this.obj.scrollHeight:this.obj.offsetHeight?this.obj.offsetHeight:this.obj.clientHeight)+"px";
						}
						this.div.style.width=(this.obj.scrollWidth?this.obj.scrollWidth:this.obj.offsetWidth?this.obj.offsetWidth:this.obj.clientWidth)+"px";
	                    this.div.style.left=getLocalOffsetLeft(this.obj);
				        this.div.style.top=getLocalOffsetTop(this.obj);
						this.div.style.zIndex=getCurrentStyle(this.obj,'zIndex')*1+1;
						this.div.style.visibility='visible';
						if(this.div.currentStyle) for(var i=0;this.obj.selectObj[i];i++) this.obj.selectObj[i].disabled=true;
						this.maskFlag=true;window.flagHideCurPopup = true;//IE bodyDivMask bug
				},
	hideMask:function(){this.div.style.visibility='hidden';this.div.style.width=0;this.div.style.height=0;this.div.style.top="-100px";this.div.style.left="-100px";if(this.div.currentStyle) for(var i=0;this.obj.selectObj[i];i++) this.obj.selectObj[i].disabled=false;this.maskFlag=false;window.flagHideCurPopup = false;},//IE bodyDivMask bug
	showMask:function(){
		if(this.obj.tagName.toLowerCase()=='body'){
			if(!this.maskFlag2 || this.maskFlag){
				if(!this.maskFlag2) this.maskFlag2 = true;
				if(isDocumentLoaded()){
					this.showMask2();
					if(this.timeoutID) this.timeoutID = null;
					this.maskFlag2 = false;
				}
				else{
					this.showMask2();
					var T = this;
					this.timeoutID = setTimeout('document.body.mask.showMask()',100);
				}
			}
			else{
				if(this.timeoutID) this.timeoutID = null;
				this.maskFlag2 = false;
			}
		}
		else this.showMask2();
	}
};

function isDocumentLoaded(){
	return (null!=document.readyState&&"complete"!=document.readyState)?false:true;
};
function getLocalOffset(offset,direction){//direction: Top Left
	var y = offset['offset' + direction];
    var div;
    try{
        div = offset.offsetParent;
    }
	catch(ex){
        //with dhtml actions that change DOM IE may throw unspecified error when checking offsetParent property
        return y;
    }
    while(div){
        y += div['offset' + direction];
		if(getCurrentStyle(div, 'position') == 'fixed'){
			var scrollTop = document.documentElement.scrollTop||document.body.scrollTop,scrollLeft = document.documentElement.scrollLeft||document.body.scrollLeft;
			y += direction=='Top'?parseFloat(scrollTop):parseFloat(scrollLeft);
		}
        try{
            div = div.offsetParent;
        }
		catch(ex){
            // with dhtml actions that change DOM IE may throw unspecified error when checking offsetParent property
            return y;
        }
    }
	
    return y;
}